﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Business.IManager;
using Entity;
using System.Data;
using DataAccess.IService;
using DataAccess.Service;

namespace Business.Manager
{
    public class GuestbookManager : IGuestbookManager
    {
        IGuestbookService guestbookService = new GuestbookService();
        public DataTable getTable()
        {
            return guestbookService.getGuestbookTable();
        }

        public GuestBook getDetail(string entityid)
        {
            return guestbookService.getGuestbookDetail(entityid);
        }

        public void publish(GuestBook guestbook)
        {
            IGuestbookService guestbookService = new GuestbookService();
            guestbookService.addNewMsg(guestbook);
        }
        public DataTable getReplys(string entityid)
        {
            return guestbookService.getGuestbookReplys(entityid);
        }

        public void reply(GuestBookReply gbr)
        {
            guestbookService.addNewReply(gbr);
        }


        public bool delete(string entityid)
        {
            return guestbookService.delEntity(entityid);
        }


        public bool deleteReply(string replyid)
        {
            return false;
        }


        public bool adminReply(string entityid,string body)
        {
            if (guestbookService.replyEntity(entityid,body))
            {
                if ( guestbookService.markSolved(entityid))
                {
                    return true;
                }
            }

            return false;

        }

        public int getUnsolvedNum()
        {
            return guestbookService.getUnsolvedNum();
        }


    }
}
